package main

import "fmt"

type Student struct {
	name string
	age  int
}

func main() {
	i := make([]interface{}, 3)
	i[0] = 1
	i[1] = "hello go"
	i[2] = Student{"xdc", 1}

	// 类型查询， 类型断言
	for _, data := range i {
		if value, ok := data.(int); ok == true {
			fmt.Println("是否是int: ", ok, " 值为：", value)
		} else if value, ok := data.(string); ok == true {
			fmt.Println("是否是string: ", ok, " 值为：", value)
		} else if value, ok := data.(Student); ok == true {
			fmt.Println("是否是Student: ", ok, " 值为：", value)
		}
	}
}
